import java.io.*;

/**
 * @author zyj
 * @date 2022年05月27日 14:39
 */
public class 复制图片 {
    public static void main(String[] args) {
        OutputStream os = null;
        InputStream in = null;

        //读的流
        try {
            in = new FileInputStream("a.png");
            os = new FileOutputStream("b.png");

            byte[] b = new byte[1024];
            int length = 0;
            while ((length = in.read(b)) != -1){
                os.write(b,0,length);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            try {
                os.close();
                in.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        //写的流
    }
}
